package com.easycms.web.monitor.controller;

import com.easycms.framework.domain.DataTableDto;
import com.easycms.framework.web.ActionResult;
import com.easycms.framework.web.BaseController;
import com.easycms.framework.web.RequestHelper;
import com.easycms.web.monitor.service.MonitorJobService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author yushuo
 * @className
 * @descripton TODO
 * @date 2021/6/3 14:24
 **/
@Controller
@RequestMapping("/monitor/job")
public class JobController extends BaseController {

    @Autowired
    private RequestHelper requestHelper;
    @Autowired
    private MonitorJobService jobService;
    /**
    *
     * @author yushuo
     * @description 执行任务
     * @date 14:26 2021/6/3
     * @param []
     * @return com.easycms.framework.web.ActionResult
    **/
    @GetMapping("/index")
    @RequiresPermissions("monitor:job:view")
    public ActionResult index(){
        return view();
    }

    /**
    *
     * @author yushuo
     * @description 获取任务列表
     * @date 15:06 2021/6/3
     * @param [dto]
     * @return com.easycms.framework.web.ActionResult
    **/
    @PostMapping("/getPageList")
    @RequiresPermissions("monitor:job:view")
    public ActionResult getPageList(DataTableDto dto){
        dto= jobService.getPageList(dto);
        return json(dto);
    }
}
